<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>{$Think.lang.withdraw}</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="INDEX/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="INDEX/css/main.css"/>
		<link rel="stylesheet" type="text/css" href="INDEX/css/cash.css"/>
	</head>

	<body>
		<style>
			/*.mui-control-content {
				background-color: white;
				min-height: 215px;
			}
			.mui-control-content .mui-loading {
				margin-top: 50px;
			}*/
			.mui-fullscreen .mui-segmented-control~.mui-slider-group {
				position: fixed;
				top:12.5%
			}
			.mui-slider-indicator.mui-segmented-control {
				position: fixed;
				top : 6.5%
			}
           .mui-switch{
      		width:36px;
        	height:18px;
      }
      header div{
      		top : 30%;
      }
      .mui-switch .mui-switch-handle{
      		width:20px;
        	height:20px;
        left:-4px;
        top: -3px;
      }
      .mui-switch.mui-active:before{
      	top:-3px;
        left:1px;
      }
      .mui-switch.mui-active .mui-switch-handle {
    	-webkit-transform: translate(43px,0);
    	transform: translate(20px,0);
		}
      .mui-switch:before{
      		top:-3px;
        	left:15px;
      }
		</style>
		<script src="INDEX/js/mui.min.js"></script>
		<script src="INDEX/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script>
			mui.init();
			mui(".mui-scroll-wrapper").scroll({
		        bounce: true,//滚动条是否有弹力默认是true
		        //indicators: false, //是否显示滚动条,默认是true
		   });
		</script>
		<header class="mui-bar mui-bar-nav">
			<a href="#offCanvasSide" class="right_top"></a>
			<!--<a class="mui-switch "></a>-->
			<div class="mui-switch mui-pull-right {if $think_var=='zh-cn'}mui-active{/if}" id="mySwitch">
  				<div class="mui-switch-handle"></div>
			</div>
			<h1 class="mui-title">{$Think.lang.project_title}</h1>
		</header>
	<div id="offCanvasWrapper" class="mui-off-canvas-wrap mui-draggable mui-slide-in">
		<div id="header">{include file='header'/}</div>
		<div class="mui-inner-wrap">
			<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper mui-slide-in">
					<div class="mui-scroll">
						<div class="mui-content">
							<div id="slider" class="mui-slider mui-fullscreen">
								<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted" style="background: #fff;">
									<a class="mui-control-item" href="#item1mobile">
									        {$Think.lang.put_earnings}
									</a>
									<a class="mui-control-item" href="#item2mobile">
										{$Think.lang.put_money}
									</a>
									<a class="mui-control-item" href="#item3mobile">
										{$Think.lang.put_jett}
									</a>
								</div>
						        <!--选中时的下划线条-->
						        <div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-4"></div>
						        <!--对应菜单的滑动选择内容-->
						        <div class="mui-slider-group">
								<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
									<div id="scroll1" class="mui-scroll-wrapper" style="top: 0;">
										<div class="mui-scroll">
											<div class="get_cash">
												<div class="get_cash_top">
													<h4 style="font-weight: normal;">{$Think.lang.put_earnings}</h4>
													<h3 style="font-weight: normal;font-size: 2em;">${$res['earnings']}</h3>
													<input type="hidden" value="{$res['earnings']}" id="put_earnings_money" class="put_earnings_money">
												</div>
											</div>
												<div class="cash_change">
													<div class="cash_input">
														<input type="number" name="earnings" id="earnings_input" placeholder="{$Think.lang.put_detail}" max="{$res['earnings']}"/>
													</div>
													<div class="cash_percent">
														<span>{$Think.lang.put_parities}</span>
														<span style="margin-left: 10px;" id="put_parities">{$setting['setting_value']}</span>
													</div>
													<div class="cash_rmb">
														<span>{$Think.lang.put_convert_money}</span>
														<span style="margin-left: 10px;color: #EE2226;" id="put_convert_money">$0</span>
													</div>
												</div>
												<div class="cash_exit">
													<div class="confirm_cash">{$Think.lang.put_submit}</div>
												</div>
												<div class="cash_history">
													<div class="cash_history_title">{$Think.lang.put_user_history}</div>
													<div class="history_table" id="tablescorll1">
														<div class="table_box">
															<table border="" cellspacing="5" cellpadding="5" rules="none">
																<tbody id="tabody1">
																	<tr>
																		<th>{$Think.lang.put_time_submit}</th>
																		<th>{$Think.lang.put_earnings_table}</th>
																	</tr>
																</tbody>
															</table>
														</div>
														<div class="more_history" id="more_history1">{$Think.lang.put_load_more}</div>
													</div>
												</div>
										  </div>
									  </div>
								 </div>
				<script>
					var pageStart1 = 1;//开始数据条数
					var more1=document.getElementById("more_history1");
					more1.addEventListener("tap", function () {
						pullfreshfunction1();
					});
					pullfreshfunction1();
					function pullfreshfunction1() {
						var __self=this;
						var url = "{:Url('index/get_withdraws')}";
						var page1= pageStart1;
						var str="";
						mui.ajax({
							type: "post",
							url: url,
							timeout: 10000,
							data: {
								page: page1
							},
							dataType: "json",
							success: function (data) {
								if (data.code == 0) {
									var list = data.data;
									for (i in list) {
										str+= "<tr>"+
												"<td>"+list[i].create_time+"</td>"+
												"<td>$"+list[i].money+"</td>"+
												"</tr>";
									}
									document.getElementById("tabody1").innerHTML+=str;
									pageStart1++;

								}else{

									mui.toast(data.message);
								}
							},
							error: function (XMLHttpRequest, textStatus, errorThrown) {
								console.log("请求失败!!！" + textStatus);
							}
						});

					}
				</script>
				<div id="item2mobile" class="mui-slider-item mui-control-content mui-active">
									<div id="scroll2" class="mui-scroll-wrapper" style="top: 0;">
										<div class="mui-scroll">
											<div class="get_cash">
												<div class="get_cash_top">
													<h4 style="font-weight: normal;">{$Think.lang.put_money_money}</h4>
													<h3 style="font-weight: normal;font-size: 2em;">${$res['balance']}</h3>
													<input type="hidden" value="{$res['balance']}" id="put_earnings_money1" class="put_earnings_money1">
												</div>
												<div class="warning">
													<div class="warning_title">{$Think.lang.put_title}：</div>
													<div>{$Think.lang.put_content1}</div>
													<div>{$Think.lang.put_content2}</div>
													<div>{$Think.lang.put_content3}</div>
												</div>

											</div>
												<div class="cash_change">
													<div class="cash_percent">
														<span>{$Think.lang.put_parities}</span>
														<span style="margin-left: 10px;" class="put_parities" id="put_parities1">{$setting['setting_value']}</span>
													</div>
													<div class="cash_rmb">
														<span>{$Think.lang.put_convert_money}</span>
														<span style="margin-left: 10px;color: #EE2226;" id="put_convert_money1">$0</span>
													</div>
												</div>
												<div class="cash_exit">
													<div class="confirm_cash confirm_cash1">{$Think.lang.put_submit}</div>
												</div>
										  </div>
									  </div>
								 </div>
			<div id="item3mobile" class="mui-slider-item mui-control-content mui-active">
									<div id="scroll3" class="mui-scroll-wrapper" style="top: 0;">
										<div class="mui-scroll">
											<div class="get_cash">
												<div class="get_cash_top">
													<h4 style="font-weight: normal;">{$Think.lang.put_earnings_jetton}</h4>
													<h3 style="font-weight: normal;font-size: 2em;">${$res['earnings']}</h3>
												</div>
											</div>
												<div class="cash_change">
													<div class="cash_input">
														<input type="number" name="jetton" id="jetton" value="" placeholder="{$Think.lang.put_detail_jetton}" max="{$res['earnings']}"/>
													</div>
												</div>
												<div class="cash_exit">
													<div class="confirm_cash_submit">{$Think.lang.put_time_submit_submit}</div>
												</div>
												<div class="cash_history">
													<div class="cash_history_title">{$Think.lang.put_ear_money}</div>
													<div class="history_table" id="tablescorll2">
														<div class="table_box">
															<table border="" cellspacing="5" cellpadding="5" rules="none">
																<tbody id="tabody2">
																<tr>
																	<th>{$Think.lang.put_time_submit}</th>
																	<th>{$Think.lang.put_earnings_table}</th>
																</tr>
																</tbody>
															</table>
														</div>
														<div class="more_history" id="more_history2">{$Think.lang.put_load_more}</div>
													</div>
												</div>
										  </div>
									  </div>
								 </div>
						        </div>
							</div>
						</div>
					</div>
			</div>
		</div>
	</div>
	</body>
	<script>
		var pageStart2 = 1;//开始数据条数
		var more2=document.getElementById("more_history2");
		more2.addEventListener("tap", function () {
			pullfreshfunction2();
		});
		pullfreshfunction2();
		function pullfreshfunction2() {
			var __self=this;
			var url = "{:Url('index/get_withdrawc')}";
			var page2 = pageStart2;
			var str="";
			mui.ajax({
				type: "post",
				url: url,
				timeout: 10000,
				data: {
					page: page2
				},
				dataType: "json",
				success: function (data) {
					if (data.code == 0) {
						var list = data.data;
						for (i in list) {
							str+= "<tr>"+
									"<td>"+list[i].create_time+"</td>"+
									"<td>$"+list[i].money+"</td>"+
									"</tr>";
						}
						document.getElementById("tabody2").innerHTML+=str;
						pageStart2++;
					}else{
						mui.toast(data.message);
					}
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					console.log("请求失败!!！" + textStatus);
				}
			});

		}
	</script>
	<script src="INDEX/js/switchover.js"></script>
	<script type="text/javascript">

		$(document).ready(function(){
			var width=$(document).width();
			var height=$(window).height();
			$(".mui-content").css({"width":width,"height":height})
		/**************************************/
			// $(".confirm_cash").click(function(){
			// 	mui.confirm("确定全部提现！","提现",['取消','确定'],function(e){
			// 		if(e.index==1){
			// 			mui.toast("提现成功")
			// 		}
			// 	})
			// })
			// 可提现收益
			var put_earnings_money = mui("#put_earnings_money")[0].value;
			var put_parities = document.getElementById("put_parities").innerText;
			var number123 = (put_earnings_money*put_parities);
			// alert(number);
			document.getElementById('put_convert_money').innerText ="$"+ number123.toFixed(3);

			//可提现本金
			var put_earnings_money1 = mui("#put_earnings_money1")[0].value;

			var number1= put_parities*put_earnings_money1;
			document.getElementById('put_convert_money1').innerText ="$"+ number1.toFixed(3);
			
			
			
			var confirm_cash = document.getElementsByClassName("confirm_cash")[0];
			confirm_cash.addEventListener("tap", function () {
				var earnings_input = document.getElementById("earnings_input").value;
				if(earnings_input < 0 )
				{
					mui.toast("{$Think.lang.put_false_earnings_input}");
					return false;
				}
				mui.confirm("{$Think.lang.sure_submit}","",['{$Think.lang.btn_cancel}','{$Think.lang.btn_sure}'],function(e){
					if(e.index==1){
                mui.ajax("{:url('Forward/earnings')}",{
                    data:{
                        earnings_input:earnings_input,
						put_earnings_money:put_earnings_money


                    },
                    dataType:'json',//服务器返回json格式数据
                    type:'post',//HTTP请求类型
                    timeout:10000,//超时时间设置为10秒；
                    success:function(data){
                        mui.toast(data["message"]);
                        setTimeout(function(){
                            window.location.reload();
                        },1000)
                    },
                    error:function(xhr,type,errorThrown){
                        //异常处理；
                        console.log(type);
                    }
                });
					}
				})
				
            });

			// 提现本金
			var confirm_cash1 = document.getElementsByClassName("confirm_cash1")[0];
			confirm_cash1.addEventListener("tap", function () {
				mui.confirm("{$Think.lang.put_submit}！","",['{$Think.lang.btn_cancel}','{$Think.lang.btn_sure}'],function(e){
					mui.ajax("{:url('Forward/balance')}",{
                    dataType:'json',//服务器返回json格式数据
                    type:'post',//HTTP请求类型
                    timeout:10000,//超时时间设置为10秒；
                    success:function(data){
                        mui.toast(data["message"]);
                        setTimeout(function(){
                            window.location.reload();
                        },1000)
                    },
                    error:function(xhr,type,errorThrown){
                        //异常处理；
                        console.log(type);
                    }
                });
				})

			})
				var confirm_cash2 = document.getElementsByClassName("confirm_cash_submit")[0];
				confirm_cash2.addEventListener("tap", function () {
					var jetton = mui("#jetton")[0].value;
					if(jetton < 0 )
					{
					mui.toast("{$Think.lang.put_false_earnings_input}");
					return false;
					}
				mui.confirm("{$Think.lang.put_sure}！","",['{$Think.lang.btn_cancel}','{$Think.lang.btn_sure}'],function(e){
					if(e.index==1){
						mui.ajax("{:url('Forward/jetton')}",{
							data:{
								jetton:jetton,

                    },
						dataType:'json',//服务器返回json格式数据
						type:'post',//HTTP请求类型
						timeout:10000,//超时时间设置为10秒；
						success:function(data){
							mui.toast(data["message"]);
							setTimeout(function(){
								window.location.reload();
							},1000)
						},
						error:function(xhr,type,errorThrown){
							//异常处理；
							console.log(type);
						}
					});
					}
				})
			})


		})


//		$(".mui-scroll-wrapper").scroll({
//		   bounce: false,//滚动条是否有弹力默认是true
//		   indicators: false, //是否显示滚动条,默认是true
//		}); 

			
	</script>
	<!--<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>-->
</html>